<?php
session_start();
include'config.php';
$user=$_POST['usename'];
$password=$_POST['password'];

$q="select * from tb where usename = '$user' and password = '$password'";
$rs= mysql_query($q);
while ($r= mysql_fetch_array($rs)) {
	
	$_SESSION['masuk'] = 1;
	$_SESSION['usename']= $_SESSION['usename'];
	$_SESSION['password']=$r['password'];
	
}

if ($_SESSION['masuk'] > 0) {
	header("location: user.php");

}
else {
		header("location: login.php?p=1");
}

?>